<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<jsp:directive.page language="java"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" />
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>咨询回复编辑</title>
		<%@ include file="/commons/includes/head.jspf"%>
		<%@ include file="/commons/manage/content.jspf"%>
		<%@ include file="/commons/extremecomponents/extremetable.jspf"%>
		<script type="text/javascript" src="<c:url value="/commons/scripts/userSelector.js" />"></script>
		<script type="text/javascript" src="consultationEdit.js"></script>
	</head>
	<body>
		<form name="consultationEdit" action="consultationEdit.shtml"
			method="post">
			<input type="hidden" id="event" name="event" value="save" />
			<input type="hidden" name="id" value="${form.id}" />
			<input type="hidden" name="state" value="${form.state}" />
			<input type="hidden" name="catalog" value="${form.catalog}" />
			<input type="hidden" name="enterprise" value="${form.enterprise}" />
			<input type="hidden" name="customService" value="${form.customService}" />
			<input type="hidden" name="expert" value="${form.expert}" />
			<c:set var="isCs" value="${CURRENT_USER.type eq 'service'}" />
			<c:set var="isExpert" value="${CURRENT_USER.type eq 'expert'}" />
			<div class="contBtnDiv">
				<span class="contBtn contBtnBack" id="btnBack">返 回</span>
				<c:if test="${form.state eq 'ASSIGNED' and isExpert}">
					<span class="contBtn contBtnSave" id="btnSave">提 交</span>
				</c:if>
				<c:if test="${form.state eq 'TOASSIGNED' and isCs}">
					<c:if test="${form.id>0}">
						<span class="contBtn contBtnNew" id="btnAssign">分 配</span>
					</c:if>
				</c:if>
			</div>
			<div class="editDiv">
				<table style="width: 100%;">
					<tr>
						<td align="center" width="15%">
							所属领域：
						</td>
						<td style="width: 35%;">
							<input type="text" class="text" style="width: 250px;" readonly="readonly"
								value="<c:out value="${allCatalog[form.catalog].fullTitle}" />" />
						</td>
						<td align="center" width="15%">
							当前状态：
						</td>
						<td style="width: 35%;">
							<input type="text" class="text" readonly="readonly"
								value="<c:out value="${stateMap[form.state]}" />" style="width: 250px;" />
						</td>
					</tr>
					<tr>
						<td align="center">
							咨询企业：
						</td>
						<td>
							<input type="text" class="text" readonly="readonly"
								value="${userMap[form.enterprise].name}" style="width: 250px;" />
						</td>
						<td align="center">
							提交时间：
						</td>
						<td>
							<input type="text" class="text" readonly="readonly"
								style="width: 250px;"
								value="<fmt:formatDate value="${form.submitTime}" pattern="yyyy-MM-dd HH:mm:ss" />" />
						</td>
					</tr>
					<tr>
						<td align="center" width="15%">
							咨询主题：
						</td>
						<td colspan="3">
							<input type="text" class="text" name="title" readonly="readonly"
								value="<c:out value="${form.title}" />" style="width: 657px;" />
						</td>
					</tr>
					<tr>
						<td align="center" valign="top" style="padding-top: 4px;">
							咨询内容：
						</td>
						<td colspan="3">
							<textarea rows="5" name="question" style="width: 657px; overflow: auto;" readonly="readonly">${form.question}</textarea>
						</td>
					</tr>
					<c:if test="${form.state ne 'TOASSIGNED'}">
						<tr>
							<td align="center">
								派单客服：
							</td>
							<td>
								<input type="text" class="text" readonly="readonly"
									value="${userMap[form.customService].name}" style="width: 250px;" />
							</td>
							<td align="center">
								派单时间：
							</td>
							<td>
								<input type="text" class="text" readonly="readonly"
									style="width: 250px;"
									value="<fmt:formatDate value="${form.receiveTime}" pattern="yyyy-MM-dd HH:mm:ss" />" />
							</td>
						</tr>
						<tr>
							<td align="center">
								咨询专家：
							</td>
							<td>
								<input type="text" class="text" readonly="readonly"
									value="${userMap[form.expert].name}" style="width: 250px;" />
							</td>
							<td align="center">
								回复时间：
							</td>
							<td>
								<input type="text" class="text" readonly="readonly"
									style="width: 250px;"
									value="<fmt:formatDate value="${form.replyTime}" pattern="yyyy-MM-dd HH:mm:ss" />" />
							</td>
						</tr>
						<c:set var="repliable" value="${isExpert and (form.expert eq CURRENT_USER.username) and (form.state ne 'REPLIED')}" />
						<c:if test="${form.state eq 'REPLIED' or repliable}">
							<tr>
								<td align="center" valign="top" style="padding-top: 4px;">
									专家答复：
								</td>
								<td colspan="3">
									<textarea class="required" title="专家答复" rows="5" name="reply"
										style="width: 657px; overflow: auto;"
										<c:if test="${not repliable}"> readonly="readonly"</c:if>>${form.reply}</textarea>
								</td>
							</tr>
						</c:if>
					</c:if>
				</table>
			</div>

			<div class="showTodoDiv">处理步骤</div>
			<div class="eXtManage">
				<table class="tableRegion" width="100%">
					<thead>
						<tr>
							<td class="tableHeader" width="100" style="padding-left: 20px;">步骤名称</td>
							<td class="tableHeader" width="90">当前状态</td>
							<td class="tableHeader" width="90">执行人</td>
							<td class="tableHeader" width="150">创建时间</td>
							<td class="tableHeader" width="150">完成时间</td>
							<td class="tableHeader">备注</td>
						</tr>
					</thead>
					<tbody class="tableBody">
						<c:forEach var="todo" items="${todoList}">
							<tr class="odd" onmouseover="this.className='highlight'" onmouseout="this.className='odd'">
								<td style="padding-left: 20px;"><c:out value="${todo.title}" /></td>
								<td><c:out value="${todo.state}" /></td>
								<td><c:out value="${userMap[todo.actor].name}" /></td>
								<td><fmt:formatDate value="${todo.create}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
								<td><fmt:formatDate value="${todo.done}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
								<td><c:out value="${todo.comment}" /></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
		</form>
	</body>
</html>